<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!doctype html>
<html lang="en">
<head>
	<title>添加文章</title>
	<script type="text/javascript" src="http://localhost/myweb/Static/hdjs/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="http://localhost/myweb/Static/hdjs/hdjs.css"/>
    <script type="text/javascript" src="http://localhost/myweb/Static/hdjs/hdjs.min.js"></script>
	<script type="text/javascript" src="http://localhost/myweb/App/Tcadmin/View/Article/js/validate.js"></script>
	<link type="text/css" rel="stylesheet" href="http://localhost/myweb/Static/kindeditor/themes/default/default.css"/>
	<script type="text/javascript" src="http://localhost/myweb/Static/kindeditor/kindeditor-min.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content"]', {
				height : '320px',
				width : '900px',
				uploadJson : "<?php echo U('Files/upload');?>",
				fileManagerJson : "<?php echo U('Files/manager');?>",
				allowFileManager : true,
			});
		});
	</script>
</head>
<body>
<div class="">
	<div class='hd-title-header'><h2>添加文章</h2></div>
	<form method='post' enctype='multipart/form-data'>
		<div class="hd-tab">
			<ul class="hd-tab-menu">
				<li class="active" lab="base">
					<a> 基本设置 </a>
				</li>
				<li lab="tpl">
					<a>其他设置</a>
				</li>
			</ul>
			<div class="hd-tab-content">
			<div class="hd-tab-area" lab="base">
				<table class='hd-table hd-table-form hd-form'>
					<tr>
						<th class="hd-w50">标题</th>
						<td><input type='text' name='title' class="hd-w300 hd-h30"/></td>
					</tr>
					<tr>
						<th>栏目</th>
						<td>
							<select name='catid' class="hd-w300 hd-h30">
							        <?php
        //初始化
        $hd['list']['c'] = array(
            'first' => false,
            'last'  => false,
            'total' => 0,
            'index' => 0
        );
        if (empty($category)) {
            echo '';
        } else {
            $listId = 0;
            $listShowNum=0;
            $listNextId=0;
            foreach ($category as $c) {
                //开始值
                if ($listId<0) {
                    $listId++;
                    continue;
                }
                //步长
                if($listId!=$listNextId){$listId++;continue;}
                //显示条数
                if($listShowNum>=100)break;
                //第几个值
                $hd['list'][c]['index']++;
                //第1个值
                $hd['list'][c]['first']=($listId == 0);
                //最后一个值
                $hd['list'][c]['last']= (count($category)-1 <= $listId);
                //总数
                $hd['list'][c]['total']++;
                //增加数
                $listId++;
                $listShowNum++;
                $listNextId+=1
                ?>
							<option value='<?php echo $c['cid'];?>'><?php echo $c['_name'];?></option>
							<?php }}?>
							</select>
						</td>
					</tr>
					<tr>
						<th>缩略图</th>
						<td><input type='file' name='thumb' class="hd-w300 hd-h30" /></td>
					</tr>
					<tr>
						<th>正文</th>
						<td><textarea name="content" id="content" ></textarea></td>
					</tr>
				</table>
			</div>
			<div class="hd-tab-area" lab="tpl">
				<table class='hd-table hd-table-form hd-form'>
					<tr>
						<th class="hd-w50">关键字</th>
						<td><input type='text' name='keywords' class="hd-w300 hd-h30"/></td>
					</tr>
					<tr>
						<th>描述</th>
						<td><textarea name='description' class="hd-w400 hd-h100"/></textarea></td>
					</tr>
					<tr>
						<th>点击次数</th>
						<td><input type='text' name='click' class="hd-w300 hd-h30" value='100'/></td>
					</tr>
					<tr>
						<th>来源</th>
						<td><input type='text' name='source' class="hd-w300 hd-h30" value=''/></td>
					</tr>
					<tr>
						<th>作者</th>
						<td><input type='text' name='author' class="hd-w300 hd-h30" value='管理员'/></td>
					</tr>
					<tr>
						<th>更新时间</th>
						<td>
						<input type="text" readonly="readonly" id="updatetime" name="updatetime" value="<?php echo date('Y/m/d h:i:s');?>" class="hd-w150 hd-h30"/>
						</td>
					</tr>
				</table>	
			</div>
			</div>
		</div>
		<div style='text-align:right;margin:10px 100px;'>
			<input type='submit' value='提交发布' class='hd-btn hd-btn-primary '/>
		</div>
	</form>
</div>
</body>
</html>
